from django.db import models


# Create your models here.
class Story(models.Model):
    type = (('Story', 'Story'),
               ('Audio', 'Audio'),
              )

    storyId = models.AutoField(primary_key=True)
    story_tile = models.CharField(max_length=200)
    type = models.CharField(choices=type, max_length=10)
    delFlag = models.BooleanField(default=False)
    # audit fields
    create_at = models.DateTimeField(auto_now_add=True)
    created_by = models.CharField(max_length=100)
    updated_at = models.DateTimeField(auto_now=True)

    def __unicode__(self):
        return '%s : %s' % (self.storyId, self.story_tile)


class StoryLine(models.Model):
    type = (('Story', 'Story'),
               ('Audio', 'Audio'),
              )

    uniqueId = models.AutoField(primary_key=True)
    storyId = models.ForeignKey(Story, related_name='storyIds')
    storyLineId = models.CharField(max_length=100)
    storyLine = models.CharField(max_length=500)
    type = models.CharField(choices=type, max_length=10)
    totalVote = models.CharField(max_length=10)
    delFlag = models.BooleanField(default=False)
    # audit fields
    create_at = models.DateTimeField(auto_now_add=True)
    created_by = models.CharField(max_length=100)
    updated_at = models.DateTimeField(auto_now=True)

    def __unicode__(self):
        return '%s : %s' % (self.uniqueId, self.storyLine)

class EntryLine(models.Model):
    type = (('Story', 'Story'),
               ('Audio', 'Audio'),
              )

    entryLineId = models.AutoField(primary_key=True)
    storyId = models.ForeignKey(Story, related_name='entryLineStoryId')
    storyLineId = models.CharField(max_length=100)
    entryLine = models.CharField(max_length=500)
    type = models.CharField(choices=type, max_length=10)
    delFlag = models.BooleanField(default=False)
    # audit fields
    create_at = models.DateTimeField(auto_now_add=True)
    created_by = models.CharField(max_length=100)
    updated_at = models.DateTimeField(auto_now=True)

    def __unicode__(self):
        return '%s : %s' % (self.entryLineId, self.entryLine)
